import React, { useState } from 'react';
import { View, StatusBar } from 'react-native';
import ChatBox from './ChatBox';
import ChangeNameBox from './ChangeNameBox';
import User from './User';

export default function Other({users, setUsers}) {
  const [isShowBox, setIsShowBox] = useState(false);
  // console.log(users,122);
  function changeIsShowBox() {
    setIsShowBox(prevState => !prevState);
  }
  return (
    <View >
      <StatusBar hidden={true} />
      <User userName={users?.[0].name} setIsShowBox={changeIsShowBox}/>
      <ChatBox users={users} setUsers={setUsers}/>
      {isShowBox &&
        <ChangeNameBox users={users} setUsers={setUsers} setIsShowBox={changeIsShowBox} />
      }
    </View>
  );
}
